
<script type="text/javascript">
    $(document).ready(function() {

        $('a[id^=delete_]').click(function()
        {
            var ids = $(this).attr('id').split('_');
            $('#categoryValue').val(ids[1])
            $('#dialog').dialog('open');
        });

        $("#dialog").dialog({
            bgiframe: true,
            autoOpen: false,
            width: 300,
            modal: true,
            title : 'Eliminar categor&iacute;a',
            buttons: {
                'Enviar': function() {
					
                    window.location = "/admin/##name##/deletecategory/category/"+$('#categoryValue').val();
                },
                'Cerrar': function() {
                    $(this).dialog('close');
                }
            },
	
        });
	
        $("#list").tablesorter({widthFixed: true, widgets: ['zebra'],headers: {0: {sorter: false }, 3: {sorter: false}}}).tablesorterPager({container: $("#pager")});
    });

</script>
<input type="hidden" id="categoryValue" value="" >
<div id="dialog">
    <br/><br/>
    <p>Est&aacute; seguro que desea borrar la categor&iacute;a?</p>
</div>

<!-- h2 stays for breadcrumbs -->
<h2><a href="#">##view_name_plural##</a> &raquo; <a href="#" class="active">Listar Categor&iacute;as</a></h2>

<div id="main">
    <h3>Raiz</h3>
    <div id="buttonAdd"><a href="/admin/##name##/newcategory"><img style="vertical-align : middle;" src="/images/icons/add.png" />&nbsp;Nueva Categor&iacute;a</a></div>
    <table cellpadding="0" cellspacing="0" id="list" class="tablesorter">
        <thead>
            <tr>
                <th style="width : 5%;"></th>
                <th>Nombre</th>
                <th>Activo</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <? $i = 0; ?>
            <? if (count($this->categories) == 0): ?>
                <tr></tr>
            <? endif; ?>
            <? foreach ($this->categories as $u): ?>
            <?
                    if ($i % 2 == 1) {
                        $class = "odd";
                    } else {
                        $class = "";
                    }
                    $i++;
            ?>
            <? if ($u['enabled'] == 1)
                        $enabled = "accept.png"; else
                        $enabled = "cancel.png"; ?>
                    <tr class="<?= $class ?>">
                        <td style="padding-left : 5px;"><img style="vertical-align : middle;" src="/images/icons/folder.png" /></td>
                        <td ><a title="<?= $u['name'] ?>" href="/admin/##name##/list##name##/category/<?= $u['id'] ?>"><?= $u['name'] ?></a></td>
                        <td ><a  href="#"><img style="vertical-align : middle;" src="/images/icons/<?= $enabled ?>" /></a></td>
                        <td class="action"><a title="Editar Categor&iacute;a" href="/admin/##name##/editcategory/id_category/<?= $u['id'] ?>" class="edit"><img src="/images/icons/pencil.png" style="vertical-align : middle;" alt="edit"  border=0 /></a><a title="Eliminar Categor&iacute;a" id="delete_<?= $u['id'] ?>" href="#"> <img style="vertical-align : middle;" src="/images/icons/delete.png" alt="remove"  border=0 /></a></td>
                    </tr>
<? endforeach ?>
        </tbody>
    </table>
    <div id="pager" class="pager">
        <form>
            <a href="#" class="first"><img border=0 src="/img/iomanager/icons/go-first.png" /></a>
            <a href="#" class="prev"><img border=0  src="/img/iomanager/icons/go-previous.png" /></a>
            <span class="pagedisplay"></span>
            <a href="#" class="next"><img border=0 src="/img/iomanager/icons/go-next.png" /></a>
            <a href="#" class="last"><img border=0  src="/img/iomanager/icons/go-last.png" /></a>
            <select class="pagesize">
                <option selected="selected"  value="10">10</option>
                <option value="20">20</option>
                <option value="50">50</option>
                <option  value="100">100</option>
            </select>
        </form>
    </div>
</div>
<!-- // #main -->

<div class="clear"></div>